export default function spliceMMDD(dateString, format = "MM.DD") {
	// 检查输入是否符合 YYYY-MM-DD 格式
	if (!/^\d{4}-\d{2}-\d{2}$/.test(dateString)) {
		throw new Error("Invalid date format. Expected format: YYYY-MM-DD");
	}

	// 分割日期
	const [year, month, day] = dateString.split('-');

	// 根据指定格式返回结果
	if (format === "MM.DD") {
		return `${month}.${day}`;
	} else if (format === "DD.MM") {
		return `${day}.${month}`;
	} else if (format === "YYYY") {
		return year;
	} else if (format === "MM") {
		return `${month}`;
	} else if (format === "DD") {
		return `${day}`;
	} else {
		throw new Error("Unsupported format");
	}
}